 <html>
<head>

<script type="text/javascript" src="build/yahoo/yahoo-min.js"></script>
<script type="text/javascript" src="build/event/event-min.js"></script>
<script type="text/javascript" src="build/connection/connection-min.js"></script>

<script type="text/javascript" src="init.js"></script>
<script type="text/javascript" src="dasParsers.js"></script>
<script type="text/javascript" src="classes.js"></script>
<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="karyotypeStructureFunctions.js"></script>

<script>

YAHOO.namespace("dasRegistry");	
YAHOO.dasRegistry = {
		specie: "Homo sapiens",
		result: new Object(),
	}

function makeRegistryRequest(){
	var proxyUrl = YAHOO.dasBrowser.genome.karyotypeStructure.proxyUrl;
	var sourceParameter = YAHOO.dasBrowser.proxy.parameters.source; // s
	var registryUrl = "http://www.dasregistry.org/das1/sources";
	var typeParameter = "Chromosome";
	var organismParameter = YAHOO.dasRegistry.specie;
	var url =  proxyUrl + "?" + sourceParameter + "=" + registryUrl + "?type=" + typeParameter + "&organism=" + organismParameter;
	//console.log(url);

    var request = YAHOO.util.Connect.asyncRequest('GET', url, registryRequestCallback);
}


var registryRequestCallback = {
    success:function(o){
		var dasRegistryResults = YAHOO.dasBrowser.dasRegistry.parse(o.responseXML);
		for (key in dasRegistryResults.sources) {
		//for(var i = 0; i < dasRegistryResults.sources.length; i++){
			//console.log(dasRegistryResults.sources[i].coordinates.length);
			//YAHOO.dasBrowser.util.displayObjProp(dasRegistryResults.sources[i]);
			console.log(key);
			console.log(dasRegistryResults.sources[key].title);
			console.log(dasRegistryResults.sources[key].description);
			/*
			for (var j = 0; j < dasRegistryResults.sources[key].label.length; j++) {
				console.log(dasRegistryResults.sources[key].label[j]);
				console.log("------");
			}
			*/
			


			//console.log(dasRegistryResults.sources[i].leaseTime);
		}
    },
    failure:function(o){
		console.log("failure");
	}
}
/*
    this.uri = new String();
	this.title = new String();
	this.docHref = new String();
	this.description = new String();
	this.maintainerEmail = new String();
	this.versionUri = new String();
	this.versionCreated = new String();
	this.projectHome = null;
	this.projectIcon = null;
	this.projectDesc = null;
	this.projectName = null;
	this.leaseTime = null;
	
	this.coordinates = new Array();
    this.label = new Array();
    this.capability = new Array();
    
    
    
    		var source = new Object();
		source.id = 'DS_224';
		source.url ='http://beta.gepas.bioinfo.cipf.es/dasviewer-0.0.1/dasserver?id=karyoviewfile_mir_txt%26cmd=features';
		source.name ='condor_human';
		source.label =['ENSEMBL'];
		source.description ='CONDOR CNE coordinates for the human genome';
		source.representation ='chart';
*/
YAHOO.util.Event.addListener(window, 'load', makeRegistryRequest);

</script>
    </head>
    <body>
    </body>
</html>
